package com.pubinfo.passbook.data.controller;

import com.pubinfo.passbook.common.model.dto.open.WiteoffData;
import com.pubinfo.passbook.common.model.http.request.GainWriteoffInstStatus.GainWriteoffInstStatusItems;
import com.pubinfo.passbook.common.model.http.response.GetAutoCreateWriteoff.WriteoffMessage;
import com.pubinfo.passbook.common.model.http.response.GetWriteoffInstStatus.WriteoffInstStatusMessage;
import com.pubinfo.passbook.common.model.vo.base.JsonResult;
import com.pubinfo.passbook.data.service.OpenWiteoffService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping(value = "open")
@Api(tags = "财辅报账")
@Slf4j
public class OpenWiteoffController {
  @Autowired
  OpenWiteoffService witeoffService;
  
  @PostMapping("createWriteoff")
  @ApiOperation(value = "发起报账")
  public JsonResult<WriteoffMessage> createWriteoff(WiteoffData data) {
    
    return JsonResult.success(witeoffService.createWriteoff(data));
  }
  
  @PostMapping("getWriteoffInstStatus/{systemCode}")
  @ApiOperation(value = "获取报账单状态")
  public WriteoffInstStatusMessage getWriteoffInstStatus(@RequestBody GainWriteoffInstStatusItems account, @PathVariable("systemCode") String systemCode) {
    return witeoffService.getWriteoffInstStatus(account, systemCode);
  }
  
}
